//
//  AdapterUtil.swift
//  weibo
//
//  Created by apple on 2023/7/6.
//  Copyright © 2023 陈明光. All rights reserved.
//

import Foundation

/// 屏幕size
let APP_SCREEN_RECT = UIScreen.main.bounds

/// 屏幕宽度
let APP_SCREEN_WIDTH = UIScreen.main.bounds.size.width

/// 屏幕高度
let APP_SCREEN_HEIGHT = UIScreen.main.bounds.size.height

/// 屏宽比
let APP_WIDTH_SCREENRATE = (APP_SCREEN_WIDTH / 375.0)

// 获取屏幕状态栏的大小
let APP_STATUS_BAR_SIZE:CGSize = UIApplication.shared.statusBarFrame.size;

// 系统版本号
let APP_SYS_VERSION:String = UIDevice.current.systemVersion

// 系统名称
let APP_SYS_NAME:String = UIDevice.current.systemName

// 设备名称
let APP_DEVICE_NAME:String = UIDevice.current.model

// 主窗口
let APP_KEY_WINDOWN:UIWindow = UIApplication.shared.keyWindow!

// bundleIdentifier
let APP_ID = Bundle.main.bundleIdentifier ?? ""

// 应用版本名1.0.0 CFBundleShortVersionString
let APP_VERSION_Name:String = String(Bundle.main.infoDictionary!["CFBundleShortVersionString"]! as! NSString)


//iPhoneX 适配
let APP_SAFEAREA_TOP_MARGIN: CGFloat = (APPGetDevice() == 10) ? 44.0 : 20.0   //安全区域上边缘高度
let APP_SAFEAREA_BOTTOM_MARGIN: CGFloat = (APPGetDevice() == 10) ? 34.0 : 0.0 //安全区域下边缘高度
//let APP_NAV_BAR_HEIGHT: CGFloat = (APPGetDevice() == 10) ? 88.0 : 64.0        //导航栏高度（包含状态栏）
///导航栏高度（包含状态栏）
let APP_NAV_BAR_HEIGHT: CGFloat = UIApplication.shared.statusBarFrame.size.height + 44.0
///标签栏高度（）
let APP_TAB_BAR_HEIGHT: CGFloat = (APPGetDevice() == 10) ? 83.0 : 49.0
//let APP_STATUS_BAR_HEIGHT: CGFloat = (APPGetDevice() == 10) ? 44.0 : 20.0     //状态栏高度
let APP_STATUS_BAR_HEIGHT = UIApplication.shared.statusBarFrame.size.height     //状态栏高度
let APP_AVAILABLE_HEIGHT: CGFloat = (APPGetDevice() == 10) ? (UIScreen.main.bounds.size.height - 88 - 34) : (UIScreen.main.bounds.size.height - 64)

func APPGetDevice() -> Int{
    if APP_SCREEN_HEIGHT == 480 {
        // IPhone4/4s
        return 1
    }else if APP_SCREEN_HEIGHT == 568 {
        // IPhone5/5c/5s
        return 2
    }else if APP_SCREEN_HEIGHT == 667 {
        // IPhone6/6s
        return 3
    }else if APP_SCREEN_HEIGHT == 736 {
        // IPhone6+/6s+
        return 4
    } else if APP_SCREEN_HEIGHT >= 812.0 {
        // IPhone X
        return 10
    }else{
        return 0
    }
}

class AdapterUtil: NSObject {

}
